<template>
	<view>
		<!-- <u-navbar title="" leftIcon="" :titleStyle="{color:'#fff'}" bgColor="#3478F5" placeholder>
			<view class="u-nav-slot" slot="left">
				<u-icon name="arrow-left" size="19" color="#3478F5"></u-icon>
			</view>
		</u-navbar> -->
		<!-- <u-navbar title="" leftIcon="" bgColor="#3478F5" placeholder></u-navbar> -->
		<u-sticky>
			<view class="headbgc ">
				<view class="flexleft" @click="jumpurl('/pages/login/login')" v-if="!is_login">
					<image src="@/static/image/system/weidenglu.png" class="headimg margin_right" mode=""></image>
					<view class="flexbetween" style="width: 100%;">
						<view class="titletext bai_text bold">未登录,点击登录！</view>
						<u-icon name="arrow-right" size="12" color="#fff"></u-icon>
					</view>
				</view>
				<view class="flexleft" @click="jumpurl('/pages_mine/gerenxx')" v-if="is_login">
					<image :src="userInfo.avatar" class="headimg margin_right" mode=""></image>
					<view class="flexbetween" style="width: 100%;">
						<view class="flexcolumnbet" style="height: 100rpx;">
							<view class="titletext bai_text bold">{{userInfo.nickname}}</view>
							<view class="xiaobai" style="color: #DFDFDF;">账号：{{userInfo.username}}</view>
						</view>
						<u-icon name="arrow-right" size="12" color="#fff"></u-icon>
					</view>
				</view>
				<view class="flexbetween topcontent margin_top6">
					<view class="flexcolumn" @click="jumpurl('/pages_mine/wodesc')">
						<view class="titletext bai_text bold">{{userInfo.collect_num || 0}}</view>
						<view class="margin_top1 bai_text main_size" style="color: #efefef;">我的收藏</view>
					</view>
					<view class="myline ffffff"></view>
					<view class="flexcolumn" @click="jumpurl('/pages_mine/cuotib')">
						<view class="titletext bai_text bold">{{userInfo.wrong_ques_num || 0}}</view>
						<view class="margin_top1 bai_text main_size" style="color: #efefef;">我的错题</view>
					</view>
					<view class="myline ffffff"></view>
					<view class="flexcolumn" @click="jumpurl('/pages_mine/wodeye')">
						<view class="titletext bai_text bold">{{userInfo.money || 0}}</view>
						<view class="margin_top1 bai_text main_size" style="color: #efefef;">我的余额</view>
					</view>
				</view>
			</view>
		</u-sticky>
		<view class="mainpadding">
			<!-- <view class="mainpadding2" style="position: relative; top: -60rpx;"> -->
			<view class="ffffff radius" style="border-radius: 16rpx; padding: 40rpx 30rpx;">
				<view class="flexbetween pdl" @click="jumpurl('/pages_mine/xuexidd')">
					<view class="flexleft">
						<image src="../static/image/system/my1.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">学习订单</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween pdl" @click="jumpurl('/pages_mine/xuexiksk')">
					<view class="flexleft">
						<image src="../static/image/system/my2.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">学习考试卡</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween pdl" @click="jumpurl('/pages_mine/xuexijl')">
					<view class="flexleft">
						<image src="../static/image/system/my11.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">学习记录</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween pdl" @click="jumpurl('/pages_mine/wodeks')">
					<view class="flexleft">
						<image src="../static/image/system/my3.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">我的考试</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween pdl" @click="jumpurl('/pages_mine/shangchengdd')">
					<view class="flexleft">
						<image src="../static/image/system/my4.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">商城订单</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween pdl" @click="jumpurl('/pages_mine/wodetw')">
					<view class="flexleft">
						<image src="../static/image/system/my5.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">我的提问</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween pdl" @click="jumpurl('/pages_mine/wodefb')">
					<view class="flexleft">
						<image src="../static/image/system/my6.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">我的发布</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween pdl" @click="jumpurl('/pages_mine/wodels')">
					<view class="flexleft">
						<image src="../static/image/system/my7.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">我的老师</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween pdl" @click="jumpurl('/pages_mine/tongzhi')">
					<view class="flexleft">
						<image src="../static/image/system/my8.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">通知</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween pdl">
					<view class="flexleft">
						<image src="../static/image/system/my9.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">联系客服</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
				<view class="margin_top4 flexbetween" @click="jumpurl('/pages_mine/shezhi')">
					<view class="flexleft">
						<image src="../static/image/system/my10.png" class="myicon margin_right" mode=""></image>
						<view class="titletext hei_text bold">设置</view>
					</view>
					<u-icon name="arrow-right" size="16" color="#999"></u-icon>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				is_login: false,
				userInfo: {},
			}
		},
		onShow() {
			this.is_login = httpRequest.checkIsLogin();
			if (this.is_login) {
				this.init()
			}
		},
		methods: {
			init() {
				httpRequest.request('/api/user/index', 'GET', {}).then(res => {
					this.userInfo = res.data
				})
			},
			jumpurl(url) {
				if (!httpRequest.checkIsLogin()) {
					uni.navigateTo({
						url: "/pages/login/login"
					})
					return false
				}
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.headbgc {
		background: linear-gradient(180deg, #3478F5 0%, #7bb3fb 100%);
		padding: 30rpx 30rpx 40rpx;

	}

	.topcontent {
		padding: 15rpx 40rpx;
		background: rgba(255, 255, 255, 0.2);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		border: 1rpx solid rgba(255, 255, 255, 0.6);
	}

	.myline {
		width: 1rpx;
		height: 40rpx;
		background-color: rgba(255, 255, 255, 0.4);
	}

	.myicon {
		width: 38rpx;
		height: 38rpx;
		min-width: 38rpx;
	}

	.pdl {
		padding-bottom: 40rpx
	}
</style>